If you try to set a Z coordinate value of the Cube to zero, it will become
aligned to the "ground level" of your scene.
You can also use this same technique to place objects in the scene. For
instance, we easily place a Cube with an origin point at their bottom face
on top of another Cube or any other objects. Make sure the 3D Cursor is
at the same location in which you want to align the object to use this
procedure.
In that case, we have the Cube with the origin point at the bottom and
another larger Cube with the 3D Cursor aligned to the top face (Figure
2.21).
Figure 2.21 - Cubes for alignment
Select the Cube you wish to move and press SHIFT+S and pick
Selection to Cursor. It makes the selected Cube jump to the 3D Cursor
location (Figure 2.22).